class Solution:
    def minEatingSpeed(self, piles, H):
        """
        :type piles: List[int]
        :type H: int
        :rtype: int
        """
        l = 1
        r = max(piles) + 1

        def could(num):
            count = 0
            for i in piles:
                count += (i + num - 1) / num
            return count <= H

        while l < r:
            m = (l + r) >> 1
            if not could(m):
                l = m + 1
            else:
                r = m
        if could(l):
            return l
        return l + 1
        
def main():
    sol = Solution()
    print(sol.minEatingSpeed())
    
if __name__=="__main__":
    main()